<template>
	<el-container>
		<el-main  style="padding:0 20px;">
			<scTable ref="table" :apiObj="apiObj" stripe :params="{jobId:jobId}">
				<el-table-column label="执行时间" prop="startTime" width="200"></el-table-column>
				<el-table-column label="执行结果" prop="status" width="100">
					<template #default="scope">
						<span v-if="scope.row.status== 0" style="color: #67C23A;"><el-icon><el-icon-success-filled /></el-icon></span>
						<span v-else style="color: #F56C6C;"><el-icon><el-icon-circle-close-filled /></el-icon></span>
					</template>
				</el-table-column>
				<el-table-column label="执行信息" prop="jobMessage" width="200"></el-table-column>
				<el-table-column label="执行日志" prop="logs" width="100" fixed="right">
					<template #default="scope">
						<el-button size="mini" @click="show(scope.row)" type="primary" text>日志</el-button>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>

	<el-drawer title="日志" v-model="logsVisible" :size="600" direction="rtl" destroy-on-close>
		<el-main  style="padding:0 20px 20px 20px;">
			<pre style="font-size: 12px;color: #999;padding:20px;background: #333;font-family: consolas;line-height: 1.5;overflow: auto;">{{logContent}}</pre>
		</el-main>
	</el-drawer>
</template>

<script>
	export default {
		data() {
			return {
				logsVisible: false,
				logContent: "",
				apiObj:this.$API.system.taskLog.list,
			}
		},
    props:{
      jobId:{
        type:String,
        default:"-1"
      }
    },
		mounted() {
		},
		methods: {
			show(row){
				this.logsVisible = true;
				this.logContent = row.jobMessage+'\n'+row.exceptionInfo
			},
		}
	}
</script>

<style>
</style>
